﻿@{
    Layout = null;    
}
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<!-- Mobile Devices Support begin -->
<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
<meta content="no-cache" http-equiv="pragma">
<meta content="0" http-equiv="expires">
<meta content="telephone=no, address=no" name="format-detection">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes"> <!-- apple devices fullscreen -->
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Mobile Devices Support end -->
<script src="~/Themes/RongJi/Style/base/js/jquery-1.10.1.min.js"></script>
<script src="~/Themes/RongJi/Style/games/shack/js/365wosplayer.min.js"></script>
<link href="~/Themes/RongJi/Style/games/shack/css/front.css" rel="stylesheet" />
<title>蓉记鲜鲜鲜-谁最摇摆</title>
</head>
<body class="bodyashake">
	<div class="AshakeGuideTop slidetog" style="display: block;">
		<img src="~/Themes/RongJi/Style/games/shack/imgs/guideimg1.png" width="320" height="172">
	</div>
	<div class="AshakeGuideFor slidetog" style="display: block;">
		<img src="~/Themes/RongJi/Style/games/shack/imgs/guideimg2.png" width="320" height="172">
	</div>
    <div class="shake-mask"></div>
	<div class="Ashake" style="display:block;">
        <span class="transhake animated"></span>
	</div>
    <input type="hidden" value="@Request.QueryString["orderNumber"]" id="orderNumber">
	<!-- 中奖提示 -->
	<div id="winning" class="AshakePrompt">
        <div class="gift-dialog">
            <div class="title">
                <h4>中奖了</h4><a class="closetip">×</a>
            </div>
            <div class="content">
                    恭喜您, 中奖了!
                    <label>页面正在跳转中，请稍等...</label>
            </div>
            <div class="foot">
                <a class="dbtn -share closetip fullA" href="javascript:;">知道了</a>
            </div>
        </div>
	</div>
     <!-- 已经领取过优惠券 -->
    <div id="alreadyReceivedPromotionCode" class="AshakePrompt">
        <div class="gift-dialog">
            <div class="title">
                <h4>已经领取过优惠券</h4><a class="closetip">×</a>
            </div>
            <div class="content">
                    您之前已经领取过优惠券, 不能再抽奖了!
            </div>
            <div class="foot">
                <a class="dbtn -share closetip" href="javascript:;">知道了</a><a href="/myaccount/mypromotioncode?promotiontype=0" target="_blank" name="showRules" class="dbtn -gifts lr">查看优惠券</a>
            </div>
        </div>
    </div>
    <!-- 未中奖提示 -->
    <div id="noWin" class="AshakePrompt">
        <div class="gift-dialog">
            <div class="title">
                <h4>很遗憾，没有中奖</h4><a class="closetip">×</a>
            </div>
            <div class="content">
                    很遗憾，没有中奖哦！
            </div>
            <div class="foot">
                <a class="dbtn -share closetip fullA" href="javascript:;">知道了</a>
            </div>
        </div>
    </div>
    <!-- 活动结束 -->
    <div class="EventStart Event02">
        <img src="~/Themes/RongJi/Style/games/shack/imgs/EventImg.png" width="67" height="65">
        <span>活动于 <font color="#e94337">2013-12-18 07:28:35 <b>已结束</b></font></span>
        <label>想获得更多游戏机会吗？ 快来我们的微信平台看看吧 </label>
    </div>
    <!-- 活动开始 -->
    <div class="EventStart Event01">
        <img src="~/Themes/RongJi/Style/games/shack/imgs/EventImg.png" width="67" height="65">
        <span>活动于 <font color="#e94337">2013-12-18 07:28:35</font> 开始</span>
        <label>想获得更多游戏机会吗？ 快来我们的微信平台看看吧</label>
    </div>
    <div class="js-joins" style="display:none; position:absolute;width:100%; bottom:45px;text-align:center;">
        <img width="122" height="36" src="">
    </div>
    <div id="jquery_jplayer_1" class="jp-jplayer-1" style="width: 0px; height: 0px;"><img id="jp_poster_0" style="width: 0px; height: 0px; display: none;"><audio id="jp_audio_0" preload="metadata" src="~/Themes/RongJi/Style/games/shack/imgs/shake_sound_male.mp3"></audio></div>
    <script type="text/javascript">
        var lock = true; rotaterang = 0; rotatecount = 0; start_shack = false;
        $(function () {
            //shack();

            //Monitor();
            var musicShack = "/Themes/RongJi/Style/games/shack/imgs/shake_sound_male.mp3";
            $(".jp-jplayer-1").jPlayer({
                ready: function () {
                    $(this).jPlayer("setMedia", {
                        mp3: musicShack
                    });
                },
                swfPath: "",
                supplied: "mp3",
                wmode: "window",
                smoothPlayBar: true,
                keyEnabled: false
            });
            $(".slidetog").click(function () {
                $(".AshakeGuideTop").stop().animate({ height: 0 }, "slow");
                $(".AshakeGuideFor").stop().animate({ height: 0 }, "slow");
                $("#jquery_jplayer_1").jPlayer("play");
                //shack();
                start_shack = true;
            });
            if (window.DeviceMotionEvent) {
                var speed = 7;
                var i = 0;
                var x = y = lastX = lastY = 0;
                window.addEventListener('devicemotion', function (e) {
                    var acceleration = e.accelerationIncludingGravity;
                    x = parseInt(acceleration.x);
                    y = parseInt(acceleration.y);
                    if (Math.abs(x - lastX) > speed && Math.abs(y - lastY) > speed) {
                        i++;
                        if (start_shack == true) {
                            $(".transhake").addClass('tada');
                            $("#jquery_jplayer_1").jPlayer("play");
                            if (lock == true) {
                                lock = false;
                                setTimeout(function () {
                                    shack();
                                }, 2000);
                            }
                        }
                        lastX = lastY = 0;
                    } else {
                        if (start_shack == false) {
                            $(".transhake").removeClass('tada');
                        }
                    }
                });
            }
            $(".closetip").click(function () {
                $(this).parents(".AshakePrompt").hide();
                $(".Ashake").show();
                $("#jquery_jplayer_1").jPlayer("play");
                //clearInterval(Monitorprize);
            });

            /*
            var Monitorprize = setInterval(function(){
                Monitor();
            },5000);
            */
        });

        //摇动手机
        function shack() {
            var orderNumber = $.trim($("#orderNumber").val());
            var submitData = {
                orderNumber: orderNumber
            };

            $.ajax({
                type: "POST",
                data: submitData,
                dataType: "JSON",
                url: "/Promotion/PlayGameGetPromotionCode",
                success: function (response) {
                    if (response == 'notPrize') {
                        //没抽中奖弹出提示信息
                        $("#noWin").show();
                        $(".js-joins").show();//参与成功显示
                        lock = true;

                        return false;
                    }
                    else if (response == 'alreadyReceivedPromotionCode') {
                        //已经领取过优惠券
                        $("#alreadyReceivedPromotionCode").show();
                        lock = true;

                        return false;
                    }
                    else if (response != '') {
                        $("#winning").show();
                        $(".js-joins").show();//参与成功显示
                        lock = true;
                        var url = '/promotion/PromotionCodeView?promotionCode=' + response + '&orderNumber=' + orderNumber;
                        setTimeout("location.href='" + url + "';", 3000);

                        return true;
                    }
                },
                error: function (err) {
                    //alert('异常错误！');
                    return false;
                }
            });
        }

        /*动态监听是否中奖*/
        /*
        function Monitor(){
             $.ajax({
                    url:"http://www.365weifu.com/front/microapps/shake/prejoin/206d6b230b4b448684127e3a2cbbd379.json?uuid=WX0991141245370237",
                    type:"get",dataType:"json",
                    timeout: 10000,
                    success:function(data){
                        if(data.timestate == 0){
                            $(".Ashake,.slidetog").hide();
                            $(".Event01").show();
                        }else if(data.timestate == 1){

                            if(data.win == "success"){
                                $(".AshakePrompt").hide();
                                $(".Ashake,.slidetog").show();

                                $("#winning").find("label").html("奖品："+data.winprize);
                                $(".AshakePrompt").hide();
                                $("#winning").show();
                            }else{
                                $(".Event01,.Event02").hide();
                                $(".Ashake,.slidetog").show();
                            }

                        }else if(data.timestate == 2){
                            $(".Ashake,.slidetog,.Event01").hide();
                            $(".Event02").show();
                            clearInterval(Monitorprize);
                        }

                    }
                });
        }
        */
    </script>
</body>
</html>